<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2020/9/20
  Time: 16:27
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head style="text-align:center">
    <title>修改班级信息</title>
    <!--使用Bootstrap-->
    <link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
    <!--引入js-->
    <script src="js/jquery-3.3.1.min.js"></script>
    <script src="js/bootstrap.min.js"></script>
</head>
<style>
    table{
        margin: 0 auto;/*居中*/
        height: 300px;/*表格高度*/
    }

    td{
        width:100px;
    }

    div{
        width: 400px;
        margin:0 auto;
        text-align: center;
    }
</style>
<body>
<%--功能块--%>
<div style="text-align:center">
    <h3>修改班级</h3>
    <%--数据提交到SetServlet中--%>
    <form action="setClasses" method="post" onsubmit="return finish()" class="well">
        <table>
            <tr>
                <td>班级编号</td>
                <td><input type="hidden" name="setCid" value="${param.setCid}" >${param.setCid}</td>
            </tr>
            <tr>
                <td>班级名称</td>
                <td><input type="text" name="setClassName" id="setClassName" value="${param.setClassName}"></td>
            </tr>
            <tr>
                <td>年&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;级</td>
                <td><input type="text" name="setGrade" value="${param.setGrade}" id="setGrade" onkeyup="this.value=this.value.replace(/[^0-9-]+/,'');"></td>
            </tr>
            <tr>
                <td>班&nbsp;&nbsp;主&nbsp;&nbsp;任</td>
                <td><input type="text" name="setTeacher" id="setTeacher" value="${param.setTeacher}"></td>
            </tr>
            <tr>
                <td>班级口号</td>
                <td><input type="text" name="setWatchword" value="${param.setWatchword}"></td>
            </tr>
        </table>
        <input type="submit" class="btn btn-info" value="确定">
        <input type="button" class="btn btn-danger" value="取消" onclick="main()">
    </form>
</div>
</body>
<script>
    //点击提交时调用这个方法，用于检查是否有未填信息
    function finish() {
        //声明变量用于记录用户名输入框中的值，使用DOM操作
        var className = document.getElementById("setClassName").value;
        var grade = document.getElementById("setGrade").value;
        var teacher = document.getElementById("setTeacher").value;
        if (className=="" || grade=="" || teacher=="") {
            alert("请将信息填写完整");
            return false;
        }
    }

    //点击取消时调用这个方法，跳转到ShowClassesServlet，再回到班级管理界面
    function main() {
        //拼接url
        var url = "showClasses?";
        url += "start="+0;
        //重新定位url
        location = url;
    }


</script>
</html>
